package com.google.android.gms.internal;

import android.content.Context;
import com.google.android.gms.ads.internal.zzbt;
import com.google.android.gms.common.internal.Hide;
import com.google.android.gms.common.internal.zzbq;
import java.util.List;
import java.util.concurrent.atomic.AtomicBoolean;
import org.json.JSONObject;

@Hide
@zzabh
public abstract class zzzg implements zzajb<Void>, zzapv {
    protected final Context mContext;
    protected final zzaof zzcct;
    private zzzn zzcoa;
    private zzahe zzcob;
    protected zzacj zzcoc;
    private Runnable zzcod;
    private Object zzcoe = new Object();
    /* access modifiers changed from: private */
    public AtomicBoolean zzcof = new AtomicBoolean(true);

    protected zzzg(Context context, zzahe zzahe, zzaof zzaof, zzzn zzzn) {
        this.mContext = context;
        this.zzcob = zzahe;
        this.zzcoc = this.zzcob.zzdcw;
        this.zzcct = zzaof;
        this.zzcoa = zzzn;
    }

    public void cancel() {
        if (this.zzcof.getAndSet(false)) {
            this.zzcct.stopLoading();
            zzbt.zzen();
            zzaip.zzh(this.zzcct);
            zzx(-1);
            zzaij.zzdfn.removeCallbacks(this.zzcod);
        }
    }

    public final void zza(zzaof zzaof, boolean z) {
        zzahw.zzby("WebView finished loading.");
        int i = 0;
        if (this.zzcof.getAndSet(false)) {
            if (z) {
                i = -2;
            }
            zzx(i);
            zzaij.zzdfn.removeCallbacks(this.zzcod);
        }
    }

    /* access modifiers changed from: protected */
    public abstract void zznr();

    public final /* synthetic */ Object zzns() {
        zzbq.zzgn("Webview render task needs to be called on UI thread.");
        this.zzcod = new zzzh(this);
        zzaij.zzdfn.postDelayed(this.zzcod, ((Long) zzlc.zzio().zzd(zzoi.zzbrg)).longValue());
        zznr();
        return null;
    }

    /* access modifiers changed from: protected */
    public void zzx(int i) {
        zzahd zzahd;
        int i2 = i;
        if (i2 != -2) {
            this.zzcoc = new zzacj(i2, this.zzcoc.zzcic);
        }
        this.zzcct.zztu();
        zzzn zzzn = this.zzcoa;
        zzacf zzacf = this.zzcob.zzcvm;
        zzkk zzkk = zzacf.zzcrv;
        zzaof zzaof = this.zzcct;
        List<String> list = this.zzcoc.zzchw;
        List<String> list2 = this.zzcoc.zzchx;
        List<String> list3 = this.zzcoc.zzctq;
        int i3 = this.zzcoc.orientation;
        long j = this.zzcoc.zzcic;
        String str = zzacf.zzcry;
        boolean z = this.zzcoc.zzcto;
        long j2 = this.zzcoc.zzctp;
        zzko zzko = this.zzcob.zzaud;
        long j3 = j2;
        long j4 = this.zzcoc.zzctn;
        long j5 = this.zzcob.zzdcn;
        long j6 = this.zzcoc.zzcts;
        String str2 = this.zzcoc.zzctt;
        JSONObject jSONObject = this.zzcob.zzdch;
        zzagd zzagd = this.zzcoc.zzcuc;
        List<String> list4 = this.zzcoc.zzcud;
        List<String> list5 = this.zzcoc.zzcue;
        boolean z2 = this.zzcoc.zzcuf;
        zzacl zzacl = this.zzcoc.zzcug;
        List<String> list6 = this.zzcoc.zzchz;
        String str3 = this.zzcoc.zzcuj;
        zziu zziu = this.zzcob.zzdcu;
        String str4 = str2;
        long j7 = j3;
        long j8 = j4;
        long j9 = j5;
        long j10 = j6;
        new zzahd(zzkk, zzaof, list, i2, list2, list3, i3, j, str, z, (zzvp) null, (zzwi) null, (String) null, (zzvq) null, (zzvs) null, j7, zzko, j8, j9, j10, str4, jSONObject, (zzpx) null, zzagd, list4, list5, z2, zzacl, (String) null, list6, str3, zziu, this.zzcob.zzdcw.zzaqw, this.zzcob.zzdcv);
        zzzn.zzb(zzahd);
    }
}
